home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / text / misc / nenscript1_3.lha / machdep.h < prev    next >
C/C++ Source or Header  |  1993-03-22  |  2KB  |  84 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. /*****************************************************
  6.  *
  7.  *  MSDOS stuff 
  8.  *
  9.  *****************************************************/
  10.  
  11. #ifdef MSDOS
  12.  
  13. # include <ctype.h>
  14. # include <string.h>
  15. # include <malloc.h>
  16.  
  17. # define STRICMP(s1,s2) _stricmp (s1,s2)
  18. # ifdef _WINDOWS
  19. #  define    STRDUP(str)    _strdup(str)
  20. # else
  21. #  define    STRDUP(str)    strdup(str)
  22. # endif
  23.  
  24. # define USERNAME    getenv("LOGNAME")!=NULL?getenv("LOGNAME"):getenv("USER")!=NULL?getenv("USER"):"Unknown")
  25.  
  26. # define    GETTIME(tm,str)    strftime(str,15,"%X",tm)
  27.  
  28. # ifdef US_VERSION
  29. #  define     GETDATE(tm,str) strftime(str,15,"%b %d %y",tm)
  30. # else
  31. #  define    GETDATE(tm,str) strftime(str,15,"%d %b %y",tm)
  32. # endif
  33.  
  34. #else /* MSDOS */
  35. #ifdef AMIGA
  36. #include <stdlib.h>
  37. #include <ctype.h>
  38. #define    LPR    "xxx" /* spooler with option to set name of printer */
  39. #define    STRICMP(s1,s2)    strcmpi(s1,s2)
  40. #define    STRDUP(str)    strdup(str)
  41. #define strrchr(char, str) stpchr(char, str)
  42.  
  43. # define    USERNAME    (getenv("USERNAME"))
  44. # define        GETTIME(tm,str) strftime(str,15,"%I:%M %p",tm)
  45. # ifdef US_VERSION
  46. #  define       GETDATE(tm,str) strftime(str,15,"%b %d %y",tm)
  47. # else
  48. #  define    GETDATE(tm,str) strftime(str,15,"%d %b %y",tm)
  49. # endif
  50. #else /* Amiga */
  51.  
  52. /*****************************************************
  53.  *
  54.  *  Unix stuff
  55.  *
  56.  *****************************************************/
  57.  
  58. # include <pwd.h>
  59. # include <string.h>
  60. # ifdef __STDC__
  61. #  include <unistd.h>
  62. # endif
  63.  
  64. # define    LPR        "lpr -P "        /* spooler with option to set name of printer */
  65.  
  66. # define    STRICMP(s1,s2)    strcasecmp(s1,s2)
  67. # ifdef ultrix
  68. #  define    STRDUP(str)    strcpy(malloc(strlen(str)+1), str)
  69. # else
  70. #  define    STRDUP(str)    strdup(str)
  71. # endif
  72.  
  73. # define    USERNAME    ((getpwuid (getuid()))->pw_name)
  74. # define     GETTIME(tm,str)    strftime(str,15,"%T",tm)
  75. # ifdef US_VERSION
  76. #  define    GETDATE(tm,str) strftime(str,15,"%h %d %y",tm)
  77. # else
  78. #  define    GETDATE(tm,str) strftime(str,15,"%d %h %y",tm)
  79. # endif
  80.  
  81. #endif /* else Amiga */
  82. #endif /* else MSDOS */
  83.  
  84.